package com.rentcars.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rentcars.entity.Carorder;
import com.rentcars.mapper.CarorderMapper;
import com.rentcars.service.CarorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 罗孝天
 */
@Service("carorderService")
public class CarorderServiceImpl implements CarorderService {
    @Autowired
    private CarorderMapper carorderMapper;

    @Override
    public int deleteByPrimaryKey(String orderid) {
        return carorderMapper.deleteByPrimaryKey(orderid);
    }

    @Override
    public String insert(Carorder carorder) {
        return carorderMapper.insert(carorder);
    }

    @Override
    public Carorder selectByPrimaryKey(String orderid) {
        return carorderMapper.selectByPrimaryKey(orderid);
    }

    @Override
    public int updateByPrimaryKeySelective(Carorder record) {
        return carorderMapper.updateByPrimaryKeySelective(record);
    }



    @Override
    public PageInfo<Carorder> queryCarOrderByPage(Integer curr, Integer pageSize) {
        PageHelper.startPage(curr,pageSize);
        List<Carorder> carorders=carorderMapper.getLikeCarorder();
        return new PageInfo<Carorder>(carorders);
    }

    @Override
    public Carorder getCarorderById(Carorder carorder) {
        return carorderMapper.getCarorderById(carorder);
    }

    @Override
    public Integer updateCarorder(Carorder carorder) {
        return carorderMapper.updateCarorder(carorder);
    }
}
